package com.example;

import com.example.car.Car;
import com.example.factory.AbstractCarFactory;
import com.example.factory.BYDFactory;
import com.example.factory.TOOFactory;

// 客户端代码
public class Client {  
    public static void main(String[] args) {  
        // 创建TOO工厂
        AbstractCarFactory tooFactory = new TOOFactory();
          
        // 使用TOO工厂创建家庭汽车和运动汽车
        Car tooFamilyCar = tooFactory.createFamilyCar();
        Car tooSportsCar = tooFactory.createSportsCar();
          
        tooFamilyCar.startEngine();
        tooSportsCar.startEngine();

        //创建BYD工厂
        AbstractCarFactory bydFactory=new BYDFactory();

        // 使用TOO工厂创建家庭汽车和运动汽车
        Car bydFamilyCar = bydFactory.createFamilyCar();
        Car bydSportsCar = bydFactory.createSportsCar();

        bydFamilyCar.startEngine();
        bydSportsCar.startEngine();

    }  
} 